// vim:set tabstop=4 shiftwidth=4 softtabstop=4 expandtab foldcolumn=1 foldmethod=marker foldclose=all:
/**
 * project: 5anet
 * File:    src/com/m5anet/filter/SetCharacter.java
 *
 * This is a Filter 
 *
 * we can set the all request data to UTF-8, so, in our system.
 * we don't need use that method:
 * String s = new String(old.getBytes(), "UTF-8");
 *
 * Author:      $Author: hylinux $
 * Date:        $Date: 2008-01-23 02:18:46 +0000 (Wed, 23 Jan 2008) $
 * Reversion:   $Rev: 13 $
 * Id:          $Id: SetCharacter.java 13 2008-01-23 02:18:46Z hylinux $
 *
 */
package com.m5anet.filter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;


public class SetCharacter implements Filter {
    
    public void init(FilterConfig config) throws ServletException {

    }

    public void doFilter(
            ServletRequest req ,
            ServletResponse res,
            FilterChain chain
            ) throws IOException, ServletException {

        req.setCharacterEncoding("UTF-8");
        chain.doFilter(req, res);

    }


    public void destroy() {


    }


}

